/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import javafx.beans.property.SimpleStringProperty;
import model.OwnedWare;

/**
 *
 * @author Hans
 */
public class OwnedWareLine {

    private OwnedWare ware;
    private SimpleStringProperty name;
    private SimpleStringProperty purchasePrice;
    private SimpleStringProperty soldPrice;
    private SimpleStringProperty dateIn;
    private SimpleStringProperty dateOut;

    /**
     * This constructor I think will only be for testing purposes. might be used
     * to create ownedwares from the gui
     *
     * @param name a short description of the item for sale
     * @param purchasePrice the price that the shop payed for the item
     * @param soldPrice the current price that the item will sell for
     * @param dateIn the date the item was put up for sale
     * @param dateOut the date that a customer bought the item. can be null.
     */
    public OwnedWareLine(String name, String purchasePrice, String soldPrice, String dateIn, String dateOut) {
        this.ware = new OwnedWare();
        this.name = new SimpleStringProperty(name);
        this.purchasePrice = new SimpleStringProperty(purchasePrice);
        this.soldPrice = new SimpleStringProperty(soldPrice);
        this.dateIn = new SimpleStringProperty(dateIn);
        this.dateOut = new SimpleStringProperty(dateOut);

    }

    /**
     * this constructor should be used when reading from database
     *
     * @param ware the existing ware
     */
    public OwnedWareLine(OwnedWare ware) {
        this.ware = ware;
        name = new SimpleStringProperty(ware.getName());
        purchasePrice = new SimpleStringProperty(ware.getPurchasePriceAsString());
        dateIn = new SimpleStringProperty(ware.getDateInAsString());
        if (ware.hasDateOut()) {
            this.dateOut = new SimpleStringProperty(ware.getDateInAsString());
        }
    }

    public String getName() {
        return name.get();
    }

    public void setName(String name) {
        this.name.set(name);
    }

    public String getPurchasePrice() {
        return purchasePrice.get();
    }

    public void setPurchasePrice(String purchasePrice) {
        this.purchasePrice.set(purchasePrice);
    }

    public String getSoldPrice() {
        return soldPrice.get();
    }

    public void setSoldPrice(String soldPrice) {
        this.soldPrice.set(soldPrice);
    }

    public String getDateIn() {
        return dateIn.get();
    }

    public void setDateIn(String dateIn) {
        this.dateIn.set(dateIn);
    }

    public String getDateOut() {
        return dateOut.get();
    }

    public void setDateOut(String dateOut) {
        this.dateOut.set(dateOut);
    }

    public OwnedWare getWare() {
        return ware;
    }

    public void setWare(OwnedWare ware) {
        this.ware = ware;
    }

}
